package com.niit.web.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.niit.bean.Job;
import com.niit.service.JobService;
import com.niit.service.impl.JobServiceImpl;
import com.niit.utils.WebKit;

@WebServlet("/AddJobControoler")
public class AddJobControoler extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Job job = WebKit.request2Bean(request, Job.class);
		JobService js = new JobServiceImpl();
		int result = js.add(job);
		if(result>0){
			response.getWriter().write("1");
		}else{
			response.getWriter().write("0");
		}
		
	}

}
